//
//  杨承海永远爱小高.c
//  杨承海c语言
//
//  Created by love G on 2023/3/16.
//

/*#include "杨承海永远爱小高.h"*/
/*#include <stdio.h>
int main()
{
    int a=9;
    printf("%d\n",a);
    {
        int b=9;
        
    }
    printf("%d\n",b);
    return 0;
}

#include <stdio.h>
int main()
{
    enum sex
    {
        MALE,
        FEMALE,
        SECRET
    };//括号内的MALE FEMALE SECRET是枚举常量
    return 0;
}

#include<stdio.h>

int main()
{
    //字面常量演示
    3.14;
    1000;
    'w';
    
    
    //const修饰的常量
    const float pai= 3.14f;
    pai = 5.14
    return 0;
}

#include<stdio.h>

int main()
{
    #define x 100
    printf("%d\n",x);
    return 0;
}
*/
/*

#include <stdio.h>
enum sex
{
    male,
    female,
    secret
    
};
int main()
{
    printf("%d\n",male);
    printf("%d\n",female);
    printf("%d\n",secret);
    return 0;
}
*/
/*
 #include<stdio.h>
 #include<string.h>
 int main()
 {
 char arr1[]="bithh";
 char arr2[]={'b','i','t'};
 char arr3[]={'b','i','t','\0'};
 printf("%s\n",arr1);
 printf("%s\n",arr2);
 printf("%s\n",arr3);
 int len = strlen(arr1);
 printf("%d\n",len);
 return 0;
 }
 */
/*
#include <stdio.h>
#include <string.h>

int main()
{
    int coding = 0;
    printf("你会去敲代码吗？（选择1 or 0）：>");
    scanf("%d",&coding);
    if (coding == 1)
    {
        printf("坚持，你会有好offer\n");
    }
    else
    {
        printf("放弃，回家卖红薯\n");
    }
    return 0;
}
*/
#include<stdio.h>
/*
int main()
{
    printf("加入小海的队伍\n");
    int line = 0 ;
    while (line<=20000)
    {
        
            line++;
        printf("我要努力敲代码\n");
    }
    if (line>20000)
    {
        printf("好offer\n");
    }
    return 0;
}
*/
/*
#include <stdio.h>

int big (int a  ,int b)
{
    int  x = 0;
    if(a>=b)
    {
        x = a;
    }
    else
    {
        x = b;
    }
    return x;
}

int main()
{
    int x = 0;
    int y = 0;
    scanf("%d %d",&x,&y);
    int z = big (x,y);
    printf("%d\n",z);
    return 0;
}
*/
/*
#include <stdio.h>

int main()
{
    int a = 0;int b = 0;
    while(scanf("%d %d",&a,&b)!=EOF)
    {
        if(a>b)
        {
            printf("%d>%d",a,b);
        }
        else if (a<b)
        {
            printf("%d<%d",a,b);
        }
        else
            printf("%d=%d",a,b);
    }
    return 0;
}
 */
/*
#include <stdio.h>

int main()
{
    int a,b,c,d,e,f,g,h,j,k;
    scanf("%d %d %d %d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f,&g,&h,&j,&k);
    printf("%d %d %d %d %d %d %d %d %d %d",a,b,c,d,e,f,g,h,j,k);
    return 0;
}
*/
/*
#include <stdio.h>
int main()
{
    int x = 0;
    while (scanf("%d",&x)!=EOF)
    {
        if(x%2==0)
        {
            printf("Even");
        }
        else
        {
            printf("Odd");
        }
    }
    return 0;
}
*/
/*
#include <stdio.h>
int main()
{
    int a=0;
    while (scanf("%d",&a)!=EOF)
    {
        int i=0;
        while(i<a){
            printf("*");
            i++;
        }
    }
        
}*/
/*
#include <stdio.h>

int main()
{
    int z,x,c,v,b;
    scanf("%d %d %d %d %d",&z,&x,&c,&v,&b);
    float n=0.0f;
    n=(z+x+c+v+b)/5;
    printf("%.1f",n);
    return 0;
}
 */
/*
#include <stdio.h>

int main()
{
    int n=0;
    scanf("%d",&n);
    int t=0;
    if(n<12)
    {
        printf("2");
    }
    else
    {
        t=2+(n/12)*4;
        printf("%d\n",t);
    }
    return 0;
}*/
/*
#include <stdio.h>

int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(a>b)
    {
        if(a>c)
        {
            if(a>d)
            {
                printf("%d",a);
            }
            else
            {
                printf("%d",d);
            }
        }
        else
        {
            if(c>d)
            {
                printf("%d",c);
            }
            else
            {
                printf("%d",d);
            }
        }
        
    }
    else
    {
        if(b>c)
        {
            if(b>d)
            {
                printf("%d",b);
            }
            else
            {
                printf("%d",d);
            }
        }
        else
        {
            if(c>d)
            {
                printf("%d",c);
            }
            else
            {
                printf("%d",d);
            }
        }
    }
    return 0;
}
*/
/*
#include <stdio.h>

int main()
{
    int a=0;
    a>0;
    while(scanf("%d",&a)!=EOF)
    {
        if(a>=0&&a<=100)
        {
            if(a<=59)
            {
                printf("E\n");
            }
            else if(a>=60&&a<=69)
            {
                printf("D\n");
            }
            else if(a>=70&&a<=79)
            {
                printf("C\n");
            }
            else if(a>=80&&a<=89)
            {
                printf("B\n");
            }
            else if(a>=90&&a<=100)
            {
                printf("A\n");
            }
        }
        else if(a>0&&a>100)
        {
            printf("F\n");
        }
    }
    return 0;
}
*/
/*
#include <stdio.h>
int main()
{
    printf("%c%c%c%c%c%c%c%c%c%c%c%c",73,32,99,97,110,32,100,111,32,105,116,33);
    return 0;
}

#include <stdio.h>

int main()
{
    int q,w,e,r,t,y,u,i,o,p;
    int a=0;
    scanf("%d %d %d %d %d %d %d %d %d %d",&q,&w,&e,&r,&t,&y,&u,&i,&o,&p);
    if(q>0)
    {
        a++;
    }
    else if(w>0)
    {
        a++;
    }
    else if(e>0)
    {
        a++;
    }
    else if(r>0)
    {
        a++;
    }
    else
    return 0;
}
*/
/*
#include <stdio.h>

int main()
{
    int n;
    int w;
    int max=0;
    int min=100;
    scanf("%d",&n);
    int x;
    for(x=0;x<n;x++)
    {
        scanf("%d",&w);
        if(w>max)
        {
            max=w;
        }
        if(w<min)
        {
            min=w;
        }
    }
    printf("%d",max-min);
    return 0;
}
*/
/*
#include <stdio.h>

int main()
{
    int i=0;
    int a=0;
    int x=0;
    int y=0;
    for(i=0;i<10;i++)
    {
        scanf("%d",&a);
        if(a>0)
        {
            x++;
        }
        else if(a<0)
        {
            y++;
        }
    }
    printf("positive:%d\n",x);
    printf("negative:%d\n",y);
    return 0;
}*/
/*
#include <stdio.h>

int main()
{
    int n=0;
    while(scanf("%d",&n)!=EOF)
    {
        int i=0;
        for(i=0;i<n;i++)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}
*/
/*
#include <stdio.h>

int add(int a,int b)
{
    return a+b;
}

int main()
{
    int x=5;
    int y=7;
    printf("%d\n",add(x,y));
    return 0;
}
*/
/*
#include <stdio.h>
#include <string.h>
int main()
{
    char arr1[10]={1,2,3,4,5,6,7,8,9,10};
    printf("%d\n",arr1[5]);
   //
    return 0;
}
*/
/*
 #include<stdio.h>
 
 int main()
 {
 int arr[10]={0};
 int i=0;
 while(i<10)
 {
 scanf("%d",&arr[i]);
 i++;
 }
 i=0;
 while(i<10)
 {
 printf("%d",arr[i]);
 i++;
 }
 printf("\n");
 return 0;
 }
 */
/*
#include <stdio.h>
int main()
{
    int gao=8;//非零；
    if(gao)
    {
        
    }
    return 0;
}
*/
/*
#include <stdio.h>

int main()
{
    
    return 0;
}*/
/*
#include <stdio.h>

int main()
{
    int i = 0;
    for (i = 0; i<10; i++)
    {
        if (i = 5)
            printf("%d ", i);
    }
    return 0;
}
*/
/*
#include <stdio.h>
int main()
{
    int a = 0, b = 0;
    for (a = 1, b = 1; a <= 100; a++)
    {
        if (b >= 20) break;
        if (b % 3 == 1)
        {
            b = b + 3;
            continue;
        }
        b = b-5;
    }
    printf("%d\n", a);
    return 0;
}
*/
#include<stdio.h>
/*
int main()
{
    int i = 0;
    for(i=3;i<=100;i+=3)
    {
        printf("%d\n",i);
    }
    return 0;
}

int main()
{
    int a = 0,b = 0,c = 0;
    scanf("%d %d %d",&a,&b,&c);
    if(a>b)
    {
        if(a>c)
        {
            if(b>c)
            {
                printf("%d %d %d ",a,b,c);
            }
            else if(b<c)
            {
                printf("%d %d %d ",a,c,b);
            }
        }
        else if(a<c)
        {
            printf("%d %d %d ",c,a,b);
        }
    }
    else if(a<b)
    {
        if(a<c)
        {
            if(b>c)
            {
                printf("%d %d %d ",b,c,a);
            }
            else if(b<c)
            {
                printf("%d %d %d ",c,b,a);
            }
        }
        else if(a>c)
        {
            printf("%d %d %d ",b,a,c);
        }
    }
    return 0;
}


int main()
{
    int i = 0;
    int j = 0;
    for(i = 100;i<=200;i++)
    {
        for(j=2;j<=200;j++)
        {
            if(i%j==0)
                break;
        }
        if(i==j)
            printf("%d ",i);
    }
    return 0;
}
*/
/*
int main()
{
    int i = 0;
    for(i = 1000;i<=2000;i++)
    {
        if(i%100==0)
        {
            if(i%400==0)
            {
                printf("%d ",i);
            }
        }
        else
        {
            if(i%4==0)
            {
                printf("%d ",i);
            }
        }
    }
    return 0;
}
*/

//非常失败的代码，不会做求最大公约数的题
/*
int main()
{
    int x = 0;
    int y = 0;
    int a = 0,b = 0;
    scanf("%d %d",&a,&b);
    if (a==b)
    {
        printf("%d ",a);
    }
    else if(a>b)
    {
        x=a-b;
        for(;;)
        {
            if(x == b)
            {
                printf("%d ",x);
                break;
            }
            if(x>b)
                x = x-b;
            else
                x=b-x;
        }
    }
    else if(a<b)
    {
        for(;;)
        {
            if(x == a)
            {
                printf("%d ",x);
                break;
            }
            x=x-a;
        }
    }
    return 0;
}
*/
/*
#include <stdio.h>
int main()
{
    int score[10] = {0};
    int i = 0;
    for(i=0; i<10; i++)
    {
        scanf("%d", &score[i]);
    }
    for(i = 0;i<10;i++)
    {
        printf("%d",score[i]);
    }
    return 0;
}

//做一个乐乐求最大值的题，改一遍
int main()
{
    int i = 0;
    int x = 0;
    int max = 0;
    scanf("%d",&x);
    max = x;
    for(i=0;i<3;i++)
    {
        scanf("%d",&x);
        if(x>max)
        {
            max = x;
        }
        else
        {
            break;
        }
    }
    printf("%d",max);
    return 0;
}
*/
//ASCII码值
/*
int main()
{
    char arr[] = {73, 32, 99, 97, 110, 32, 100, 111, 32, 105, 116 , 33};
    int sc = 0;
    int i = 0;
    sc = sizeof(arr)/sizeof(arr[0]);//计算数组的元素个数
    for(i = 0;i<sc;i++)
    {
        printf("%c ",arr[i]);
    }
    return 0;
}
*/
/*
int main()
{
    int a = 0,b = 0,c = 0;
    scanf("%d %d %d",&a,&b,&c);
    int tmp;
    if(a<b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }
    if(a<c)
    {
        tmp = a;
        a = c;
        c = tmp;
    }
    if(b<c)
    {
        tmp = b;
        b = c;
        c = tmp;
    }
    printf("%d %d %d",a,b,c);
    return 0;
}
*/
/*
//求100·200素数
//接下来试除法
#include <math.h>
int main()
{
    int i = 0;
    int j = 0;
    int count = 0;
    for(i=100;i<=200;i++)
    {
        int flag = 1;
        for(j = 2;j <= sqrt(i);j++)
        {
            if(i%j==0)
            {
                flag = 0;
                break;
            }
        }
        if(flag == 1)
        {
            printf("%d ",i);
            count++;
        }
    }
    printf("\n%d\n ",count);
    return 0;
}
*/
/*
int main()
{
again:
    printf("haha\n");
    printf("heihei\n");
    goto again;
    return 0;
}
*//*
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    char  arr[20] = {0};
    system("shutdown -s -t 60");
again:
    printf("请注意，你的电脑在1分钟内关机，如果输入：我是猪，就取消关机\n");
    scanf("%s",arr);
    if (strcmp(arr,"我是猪") == 0)
    {
        system("shutdown -a");
    }
    else
    {
        goto again;
    }
    return 0;
}

#include <stdio.h>

int main()
{
    int m = 0;
    int a = 0;
    int b = 0;
    scanf("%d %d",&a,&b);
    m = (a>b?a:b);//条件操作符
    printf("%d \n",m);
    return 0;
}

#include<stdio.h>
int main()
{
    int a = 3;
    int b = 5;
    int c = 100;
    
    int d = (a += 2, b = a-5, c = a + b);
    //d的结果是最后一个表达时（c = a + b）；d是5；
    printf("%d\n",d);
    return 0;
}

#include<stdio.h>

int main()
{
    char arr[10]={1,2,3,4,5,6,7,8,9,10};
    int a = arr[8];//arr[]中的[]是下标引用；
    printf("%d",a);
    return 0;
}
*/
/*
#include <stdio.h>
//此处为函数的定义
int Max(int a,int b)
{
    return (a>b?a:b);
}

int main()
{
    int x = 0;
    int y = 0;
    scanf("%d %d",&x,&y);
    int max= Max(x,y);//此处为调用函数；（）为函数调用
    printf("%d\n",max);
    return 0;
}
*/
/*
typedef unsigned int uint_32;
#include<stdio.h>

int main()
{
    unsigned int num1 = 0;
    uint_32 num2 = 0;
    return 0;
}
*//*
#include <stdio.h>
void test()
{
    static int a = 1;//函数结束后，a的值不会重置为1，除非整个程序结束。
    a++;
    printf("%d ",a);
}
int main()
{
    int i = 0;
    while(i < 10)
    {
        test();
        i++;
    }
    return 0;
}
*/





/*
#include <stdio.h>
int main()
{
    extern int x;
    printf("%d\n",x);
    return 0;
}
*/
/*
#include<stdio.h>


#define MAX 1000


#define ADD(x,y) ((x) + (y))
    
int main()
{
    int sum = ADD(2,3);
    printf("%d\n",sum);
    
    sum = 10*ADD(2,3);
    printf("sum = %d\n",sum);
    return 0;
}
*/
#include<stdio.h>
/*
int main()
{
    int num = 10;
    &num;//取出num的地址
    //注：这里num的4个字节，每个字节都有地址，取出的是第一个字节的地址（较小的地址）
    printf("%p\n",&num);
    return 0;
}

int main()
{
    int num = 10;
    &num;
    int * p;//p是一个整形指针变量；
    p = &num;
    printf("%d\n",num);
    *p = 20;
    printf("%d\n",num);
    return 0;
}
int main()
{
    char ch = 'w';
    char * p = &ch;
    *p = 'h';
    printf("%c\n",ch);
    return 0;
}*//*
int main()
{
    printf("%d\n",sizeof(char*));
    printf("%d\n",sizeof(short*));
    printf("%d\n",sizeof(int*));
    printf("%d\n",sizeof(double*));
    return 0;
}
*//*
struct Student//这个东西就是一个图纸，概念图。
{
    char name[20];
    int  age;
    char sex[5];
    int id[15];
};
//下面才是房子
int main()
{
    struct Student s1 = {"张三",20,"男",2208170319};
    printf("%s %d %s %d\n",s1.name,s1.age,s1.sex,s1.id);
    struct Student * p = &s1;
    printf("%s %d %s %d\n",(*p).name,(*p).age,(*p).sex,(*p).id);
    return 0;
}

*/
//
#include <stdio.h>
/*int is_leap_year(int i)
{
    if(i%100 == 0)
    {
        if(i%400 == 0)
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
    else
    {
        if(i%4 == 0)
        {
            return 1;
        }
        else
        {
            return 0;
        }
    }
}
*//*
int is_leap_year(i)
{
    if(i%4 == 0 && i%100 != 0 || i%400 == 0)
    {
        return 1;
    }
    return 0;
}
int main()
{
    int i = 0;
    for(i = 1000;i <= 2000;i++)
    {
        if(1 == is_leap_year(i))
        {
            printf("%d ",i);
        }
    }
    return 0;
}
*/

/*
#include<stdio.h>

int main()
{
    int day = 0;
    scanf("%d",&day);
    switch(day)
    {
    case 1:
        printf("星期一\n");
        break;//break跳出循环
    case 2:
        printf("星期二\n");
            break;
    case 3:
        printf("星期三\n");
        break;
    case 4:
        printf("星期四\n");
        break;
    case 5:
        printf("星期五\n");
        break;
    case 6:
        printf("星期六\n");
        break;
    case 7:
        printf("星期天\n");
        break;
    }
    return 0;
}*//*
#include<stdio.h>
int main()
{
    int day = 0;
    scanf("%d",&day);
    switch(day)
    {
    case 1:
       
    case 2:
        
    case 3:
        
    case 4:
       
    case 5:
        printf("weekday\n");
        break;
    case 6:
       
    case 7:
        printf("weekend\n");
        break;
    }
    return 0;
}
*//*
#include<stdio.h>

int main()
{
    int n = 1;
    int m = 2;
    switch(n)
    {
        case 1:
            m++;
        case 2:
            n++;
        case 3:
            switch(n)
            {//switch允许嵌套使用
                case 1:
                    n++;
                case 2:
                    m++;
                    n++;
                    break;
            }
        case 4:
            m++;
            break;
        default:
            break;
    }
    printf("m = %d,n = %d\n",m,n);
    return 0;
}*//*
#include<stdio.h>

int main()
{
    int i = 0;
    while(i<=10)
    {
        printf("%d ",i);
        i++;
    }
    return 0;
}
*/
#include<stdio.h>
/*
int main()
{
    int i = 1;
    while(i <= 10)
    {
        if(i == 5)
        {
            break;
        }
        printf("%d ",i);
        i++;
    }
    return 0;
}
int main()
{
    int i = 1;
    while(i <= 10)
    {
        if(i == 5)
            continue;
        printf("%d ",i);
        i++;
    }
    return 0;
}*/
#include<stdio.h>
/*
int main()
{
    int ch = 0;
    ch = getchar();
    putchar(ch);
    return 0;
}

int main()
{
    int i = 0;
    int j = 0;
    for(i = 0;i < 10;i++)
    {
        for(j = 0;j < 10;j++)
        {
            printf("hehe\n");
        }
    }
    return 0;
}
*//*
int main()
{
    int x,y;
    for(x = 0,y = 0;x < 2 && y < 5;x++,y++)
    {
        printf("hehe\n");
    }
    
    return 0;
}
*//*
int main()//计算n的阶乘
{
    int n = 0;
    scanf("%d",&n);
    int i = 0;
    int jet = 1;
    for(i = 1;i < n+1;i++)
    {
        jet = jet * i;
    }
    printf("%d\n",jet);
    return 0;
}

*//*
int main()
{
    int i = 0;
    int jet = 1;
    int x = 0;
    for(i = 1;i <= 10;i++)
    {
        jet *= i;
        x = x + jet;
    }
    printf("%d",x);
    return 0;
}*//*
#include<stdio.h>

int main()
{
    int arr[20] = {1,2,3,4,5,6,7,8,9,10};
    int sz = sizeof(arr)/sizeof(arr[0]);//计算数组的元素个数
    int k = 17;
    int i = 0;
    int flag = 0;
    for(i = 0;i <= sz;i++)
    {
        if(arr[i] == k)
        {
            flag = 1;
            printf("找到了，下标是%d",i);
            break;
        }
    }
    if(flag == 0)
    {
        printf("没找到");
    }
    return 0;
}*/



/*
//在一个有序数组中查找具体某个数字n；

#include<stdio.h>
#include<string.h>
int main()
{
    int k = 10;
    int arr[] = {1,2,3,4,5,6,7,8,9,10};
    printf("猜猜k是几？\n");
    int left = 0;
    int right = 0;
    int sz = 0;
    sz = sizeof(arr)/sizeof(arr[0]);
    right = sz - 1;
    int mid = (left + right)/2;
    while(left <= right)
    {
        if(k > arr[mid])
        {
            left = mid + 1;
            mid = (left + right)/2;
        }
        else if(k < arr[mid])
        {
            right = mid - 1;
            mid = (left + right)/2;
        }
        else
        {
            break;
        }
    }
    printf("在数组中下标是%d\n",mid);
    return 0;
}
*//*
int main()
{
    int arr[] = { 1,2,3,4,5,6,7,8,9,10 };
   //            0 1 2 3 4 5 6 7 8 9
    int k = 7;//k是要查找的数字
     int i = 0;
     int sz = sizeof(arr) / sizeof(arr[0]);
    //折半查找（二分查找），前提是数组有序
    int left = 0;
     int right = sz - 1;

     int flag = 0;
    while (left<=right)
     {
        //int mid = (left + right) / 2;
        int mid = left + (right - left) / 2;

        if (arr[mid] < k)
        {
            left = mid + 1;
        }
        else if (arr[mid] > k)
        {
            right = mid - 1;
        }
        else
        {
            printf("找到了，下标是：%d\n", mid);
            flag = 1;
            break;
        }
    }
    if (flag == 0)
        printf("找不到\n");

    return 0;
 }*/




//编写代码，演示多个字符从两边移动，向中间汇聚。
/*
#include<stdio.h>
#include <unistd.h>//我这是ios系统，window系统用#include<windows.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    char arr1[] = "welcome to bit...";
    char arr2[] = "*****************";
    int left = 0;
    int right = strlen(arr1)-1;
    while(left <= right)
    {
        arr2[left] = arr1[left];
        arr2[right] = arr1[right];
        printf("%s\n",arr2);
        sleep(1);
        system("cls");
        left++;
        right--;
    }

    return 0;
}*//*
    

    
    
    
//编写代码实现，模拟用户登录情景，并且只能登录三次。(只允许输入三次密码，如果密码正确则 提示登录成，如果三次均输入错误，则退出程序。
#include<stdio.h>
#include<string.h>
int main()
{
    int i = 1;
    int flag = 0;
    char password[20] = {};
    for(i = 0;i < 3;i++)
    {
        printf("请输入密码");
        scanf("%s",&password);
        if(strcmp(password ,"123456") == 0)
        {
            flag =1;
            break;
        }
    }
    if (flag == 0)
    {
        printf("密码错误");
    }
    return 0;
}*//*
#include<stdio.h>
#include<string.h>

int main()
{
    int i = 0;
    char psd[20] = {};
    int flag = 0;
    for(i = 0;i < 3;i++)
    {
        scanf("%s",psd);
        if(strcmp(psd,"123456") == 0)
        {
            flag = 1;
            printf("log in\n");
            break;
        }
        else{
            printf("irror\n");
        }
    }
    if(flag == 0)
    {
        printf("irror\n");
    }
    return 0;
}
*/



//猜数字游戏实现
/*
#include<stdio.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
void menu()
{
    printf("******************************\n");
    printf("************1.play************\n");
    printf("************0.exit************\n");
    printf("******************************\n");
}
void game()
{
    int random_num = rand()%100+1;
    int i = 1;
    while(1)
    {
        printf("请输入你猜的数_");1
        scanf("%d",&i);
        if(i > random_num)
        {
            printf("猜大了\n");
        }
        else if(i < random_num)
        {
            printf("猜小了\n");
        }
        else
        {
            printf("猜对了\n");
        }
    }
}

int main()
{
    int i = 0;
    srand((unsigned)time(NULL));
    for(;;)
    {
        menu();
        printf("是否进入游戏（1/0）？\n");
        scanf("%d",&i);
        if(i == 1)
        {
            printf("进入游戏～\n");
            game();
        }
        else if(i == 0)
        {
            printf("退出游戏\n");
        }
        
    }
    return 0;
}
*/


/*二维数组
#include<stdio.h>

int main()
{
    int i = 0;
    int j = 0;
    int arr[3][4] = {1,2,3,4,5,6,7,8,9,10,11,12};
    for(i = 0;i < 3;i++)
    {
        for(j = 0;j < 4;j++)
        {
            printf("%d ",arr[i][j]);
        }
        printf("\n");
    }
    return 0;
}
*/



//乘法口诀表
/*
#include<stdio.h>

int main()
{
    int arr[] = {};
    int i = 0;
    int x = 0;
    int j = 0;
    for(j = 1; j < 10; j++){
        for(i = 1; i <= j; i++ )
        {
            x = i * i;
            printf("%d*%d=%d ",i,i,x);
        }
        printf("\n");
    }
    

    return 0;
}*/




//求十个整数中最大值
/*
#include<stdio.h>
int main()
{
    int i = 0;
    int x = 0;
    int tmp = 0;
    for(i = 0; i<10; i++)
    {
        scanf("%d",&x);
        if(x > tmp)
        {
            tmp = x;
        }
    }
    printf("%d\n",tmp);
}
*/


//分数求和
//计算1/1 - 1/2 + 1/3 - 1/4 + 1/5 …… + 1/99 - 1/100 的值，打印出结果
//#include<stdio.h>
/*
int main()
{
    int i = 0;
    int j = 0;
    double x = 0;
    for(j = 0; j <= 100; j++)
    {
        for(i = 1; i <= j; i++)
        {
            x = 1.0/i ;
  
        }
        printf("%lf ",x);
    }
    
    printf("\n");
    return 0;
}
*/




//数9的个数
//编写程序数一下 1到 100 的所有整数中出现多少个数字9
/*
#include <stdio.h>
int main()
{
    int i = 0;
    int count = 0;
    for(i = 1; i <= 100; i++)
    {
        if(i)
        {
            count++;
        }
    }
    
    return 0;
}
*/
//猜数字游戏实现
/*
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void menu()
{
    printf("*************************************\n");
    printf("*********是否进入游戏？（1/0）**********\n");
    printf("*************************************\n");
}
void game()
{
    int j = 0;
    int k = 0;
    k = rand()%100+1;
    printf("开始游戏\n");
    for(;;)
    {
        printf("请输入你猜的数__\n");
        scanf("%d",&j);
        if(j > k)
        {
            printf("猜大了\n");
        }
        else if(j < k)
        {
            printf("猜小了\n");
        }
        else
        {
            printf("恭喜你，猜对了！");
            break;
        }
    }
}
int main()
{
    int i = 0;
    int j = 0;
    srand((unsigned int)time(NULL));
    
    menu();
    do
    {
        scanf("%d",&i);
        if(i == 1)
        {
            printf("进入游戏\n");
            game();
            break;
        }
        else if(i == 0)
        {
            printf("退出游戏\n");
        }
        else
        {
            printf("error");
        }
    }while(i);
    return 0;
}
*/
//二分查找
//编写代码在一个整形有序数组中查找具体的某个数
//要求：找到了就打印数字所在的下标，找不到则输出：找不到。
/*
#include<stdio.h>
int main()
{
    int arr[] = {0,1,2,3,4,5,6,7,8,9,10};
    int k,i,sz,left,right,mid = 0;
    sz = sizeof(arr)/sizeof(arr[0]);
    k = 8;
    left = arr[0];
    right = arr[sz-1];

    while(left <= right)
    {
        mid = (left + right)/2;
        if(arr[mid]<k)
        {
            left = mid + 1;
        }
        else if(arr[mid]>k)
        {
            right = mid - 1;
        }
        else
        {
            printf("找到了，下标是%d\n",mid);
            break;
        }
    }
    
    return 0;
}
*/
//复习一手，打印100到200的素数～
/*
#include<stdio.h>
#include<math.h>
int main()
{
    int i,j,flag = 0;
    for(i = 100; i < 200; i++)
    {
        for(j = 2; j <= sqrt(i);j++)
        {
            if(i%j == 0)
            {
                flag = 0;
                break;
            }
        }
        if(j > sqrt(i))
        {
            flag = 1;
        }
        if(flag == 1)
        {
            printf("%d ",i);
        }
    }
    return 0;
}*/
//麻痹的，我怎么忘的这么快！！！！操你吗！气死我了，，差一点不对就不行啊啊啊啊啊啊！！！

//猜数字游戏实现
/*
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void menu()
{
    printf("******************************\n");
    printf("******是否进入游戏（1/0）********\n");
    printf("******1.extrance**************\n");
    printf("******************************\n");
}
void game()
{
    int k = 0;
    k = rand()%100+1;
    for(;;)
    {
        int j = 0;
        printf("请输入你猜的数字_\n");
        scanf("%d",&j);
   
        if(j>k)
        {
            printf("猜大了\n");
        }
        else if(j<k)
        {
            printf("猜小了\n");
        }
        else
        {
            printf("恭喜你，猜对了！\n");
        }
    }

    
}
int main()
{
    menu();
    srand((unsigned int)time(NULL));
    int i = 0;
    do
    {
        scanf("%d",&i);
        switch(i)
        {
            case 1:
                printf("进入游戏\n");
                game();
                break;
            case 0:
                printf("退出游戏\n");
                break;
            default :
                break;
        }
    }while(i);
   
    return 0;
}*/
//开始敲三子棋
/*#include<stdio.h>

int main()
{
    return 0;
}
*/
